﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.Text;
using System.Threading.Tasks;

namespace MotionControl.Restful
{
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Single, IncludeExceptionDetailInFaults = true)]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class MCMsgServices : IMCCommand
    {
        public Action<string> plcAction;
        public Action<string> lightAction;
        public MCMsgServices()
        {

        }

        public bool ExcuteCommand(string cmd)
        {
            if (plcAction == null)
                return false;
            plcAction.Invoke(cmd);
            return true;
        }

        public bool SetLight(string lightParam)
        {
            if (lightAction == null)
                return false;
            lightAction.Invoke(lightParam);
            return true;
        }
    }
}
